import Props from '../base/Props';
import { Row } from 'antd';
import { When } from 'react-if';
import { WeaInput, WeaSelect, WeaInputNumber, WeaLocaleProvider } from 'ecCom';
import defaultData from './data';
const getLabel = WeaLocaleProvider.getLabel;

export default class LBSProps extends Props {

  options = [{
    key: "1",
    showname: getLabel('519471', '只显示当前位置，不显示周围热点')
  },
  {
    key: "2",
    showname: getLabel('519472', '显示当前位置和热点')
  },
  {
    key: "3",
    showname: getLabel('519473', '显示点前位置和热点，并允许改变位置')
  }];

  renderContent() {
    const { name, type, radius, num } = this.props.data;

    return (
      <React.Fragment ecId={`${this && this.props && this.props.ecId || ''}_Fragment@mfkdjy`}>
        <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@if1i4n`}>
          <label>{getLabel('30828', '显示名称')}</label>
          <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@vz3qzw`}
            value={name}
            onChange={this.handlePropChange('name')}
            inputType={"multilang"}
            isBase64={true}
          />
        </Row>
        <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@t67hz2`}>
          <label>{getLabel('519468', '定位类型')}</label>
          <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@2ltl42`}
            style={{ width: '100%' }}
            options={this.options}
            value={type}
            onChange={this.handlePropChange('type')}
          />
        </Row>
        <When ecId={`${this && this.props && this.props.ecId || ''}_When@hyn9db`} condition={type !== '1'}>
          <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@zumbtg`}>
            <label>{getLabel('519469', '搜索半径')}</label>
            <WeaInputNumber ecId={`${this && this.props && this.props.ecId || ''}_WeaInputNumber@jhlyy1`}
              min={100}
              max={10000}
              value={radius}
              onChange={this.handlePropChange('radius')}
            />
          </Row>
          <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@9ogh06`}>
            <label>{getLabel('519470', '热点个数')}</label>
            <WeaInputNumber ecId={`${this && this.props && this.props.ecId || ''}_WeaInputNumber@1jz231`}
              min={1}
              max={100}
              value={num}
              onChange={this.handlePropChange('num')}
            />
          </Row>
        </When>
      </React.Fragment>
    );
  }

  renderVerifyContent() {
    return null;
  }
}

LBSProps.defaultProps = {
  data: defaultData,
  onChange: () => { }
}